/**
 * Created by Administrator on 2017/3/9.
 */

import {allUrl} from '../scripts/url'
import {Toast,checkLogin,getFormatDateByLong} from '../scripts/tip'

export const login =(account,passwd)=>{

        $.post(''+allUrl()+'user/login',{
            account:account,
            accountType:0,
            passwd:passwd
        }, (data) => {

            data=$.parseJSON(data);

            checkLogin(data, false, '');

            if(data.head.returnCode===0){

                if(data.head.subCode===0){

                    window.history.back();

                }else {
                    Toast(data.head.subMsg,2000,'');
                }
            }else {
                Toast(data.head.returnMsg,2000,'');
            }
        })


};
